package net.hombrecero.bigbeat.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.hibernate.annotations.AccessType;

@Entity
@AccessType( "field" )
public class Driver extends Base {
    @ManyToOne( cascade = { CascadeType.PERSIST, CascadeType.MERGE } )
    @JoinColumn( name="uuidProject", nullable=false )
    private Project project;
	@OneToMany( targetEntity = Node.class, mappedBy = "driver" , cascade = { CascadeType.ALL } )
	private Set nodes = new HashSet();
    @Column( length=32, nullable = false )
	private String name;
	@Column( length=32, nullable = false )
	private String ip;
	@Column( nullable = false )
	private int portApp;
	@Column( nullable = false )
	private int portClass;
	@Column( nullable = false )
	private int portNode;



	public Project getProject() {
		return this.project;
	}
	public void setProject( Project project ) {
		this.project = project;
	}
	public String getName() {
		return this.name;
	}
	public void setName( String name ) {
		this.name = name;
	}
	public String getIp() {
		return this.ip;
	}
	public void setIp( String alias ) {
		this.ip = alias;
	}
	public int getPortApp() {
		return this.portApp;
	}
	public void setPortApp( int appStatus ) {
		this.portApp = appStatus;
	}
	public int getPortClass() {
		return this.portClass;
	}
	public void setPortClass( int portClass ) {
		this.portClass = portClass;
	}
	public int getPortNode() {
		return this.portNode;
	}
	public void setPortNode( int portNode ) {
		this.portNode = portNode;
	}
	public Set getNodes() {
		return this.nodes;
	}
	public void setNodes( Set nodes ) {
		this.nodes = nodes;
	}
}
